﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManagerList.aspx.cs" Inherits="Manage_WebPages_DevManage_Manager_ManagerList" %>
<%@ Import Namespace="QuickORM.Common" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>项目管理</title>
    <script src="../../../js/jquery.js" type="text/javascript"></script>
    <script src="../../../js/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <link href="../../../js/bootstrap/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="../../../js/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <script src="../../../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript">
        function showDetail() {
            openDialogResize('Detail.aspx', 600, 500);
        };

        function openDialogResize(actionUrl, width, height) {
            var locX = (screen.width - width) / 2;
            var locY = (screen.height - height) / 2;
            var attrs = null;
            attrs = "width=" + width;
            attrs += ",height=" + height;
            attrs += ",left=" + locX;
            attrs += ",top=" + locY;
            attrs += ',toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no';
            window.open(actionUrl, "新窗体", attrs);
        };

        function delCheck() {
            var checked = 0;
            var input = document.getElementsByTagName('input');
            for (var i = 0; i < input.length; i++) {
                if (input[i].type == 'checkbox' && IsMatch(input[i].id, 'cbkItem', 'rptList')) {
                    if (input[i].checked) {
                        checked++;
                    }
                }
            }

            if (checked > 0) {
                return true;
            }
            alert('请先选择要删除的项。');
            return false;
        }

        function editCheck() {
            var checked = 0;
            var input = document.getElementsByTagName('input');
            for (var i = 0; i < input.length; i++) {
                if (input[i].type == 'checkbox' && IsMatch(input[i].id, 'cbkItem', 'rptList')) {
                    if (input[i].checked) {
                        checked++;
                    }
                }
            }
            if (checked == 0) {
                alert('请先选择要操作的项。');
                return false;
            }

            if (checked > 1) {
                alert('每次只能操作一项。');
                return false;
            }
            return true;
        }

        function checkAll() {
            var cbk = document.getElementById('cbkAll');
            var input = document.getElementsByTagName('input');
            for (var i = 0; i < input.length; i++) {
                if (input[i].type == 'checkbox' && IsMatch(input[i].id, 'cbkItem', 'rptList')) {
                    input[i].checked = cbk.checked;
                }
            }
        }

        function IsMatch(id, ChildId, controlID) {
            var sPattern = '^' + controlID + '+.*' + ChildId + '$';
            var oRegExp = new RegExp(sPattern);
            if (oRegExp.exec(id))
                return true;
            else
                return false;
        }
    </script>
    <style type="text/css">
        .style2 {
            text-align: center;
            width: 55px;
        }
    </style>
</head>
<body>
<!-- Form表单 -->
<form id="form1" runat="server">
    <div style="border: 1px solid cornflowerblue; height: 40px; margin: 1px 1px;">
        <div class="form-inline" style="margin-left: 10px; margin-right: 10px; margin-top: 10px;">
            <label class="control-label" for="inputEmail">
                类别:
            </label>
            <asp:DropDownList ID="dpManagerType" runat="server" Width="200px">
                <asp:ListItem Value="">全部</asp:ListItem>
                <asp:ListItem>通知公告</asp:ListItem>
                <asp:ListItem>资讯</asp:ListItem>
                <asp:ListItem>文件下载</asp:ListItem>
                <asp:ListItem>学术园地</asp:ListItem>
            </asp:DropDownList>
            <label class="control-label" for="inputEmail">
                标题
            </label>
            <input class="input-small" runat="server" style="width: 150px;" id="txtContains"/>
            <asp:Button ID="btn_query" runat="server" Text="检索" CssClass="btn btn-primary" OnClick="btn_query_Click"/>
            &nbsp;&nbsp;

            <input type="button" class="btn" value="添加" onclick="openDialogResize('ManagerListAdd.aspx', '800', '600')"/>
            <%-- <asp:Button ID="btn_edit" runat="server" CssClass="btn" Text="添加"  OnClick="btn_add_Click" />--%>
            &nbsp;&nbsp;
            <asp:Button runat="server" Text="删除" ID="btn_delete" CssClass="btn" OnClientClick="if (confirm('确定要删除吗?')) {return delCheck();} else {return false;}"
                        OnClick="btn_delete_Click"/>
        </div>
    </div>
    <!-- table -->
    <div class="box-content">
        <table class="table table-hover table-bordered table-striped">
            <thead>
            <tr>
                <th>
                    <input id="cbkAll" type="checkbox" onclick="checkAll();"/>
                    选择
                </th>
                <th>
                    类别
                </th>
                <th>
                    标题
                </th>
                <th>
                    内容
                </th>
                <th>
                    发布时间
                </th>
                <th>
                    发布人
                </th>

            </tr>
            </thead>
            <tbody>
            <asp:Repeater ID="rptList" runat="server">
                <ItemTemplate>
                    <tr>
                        <td class="style2">
                            <asp:CheckBox runat="server" ID="cbkItem"/>
                            <asp:HiddenField ID="hfID" runat="server" Value='<%#Eval("m_id").ToString() %>'/>
                        </td>

                        <td>
                            <%#Eval("M_type").ToString() %>
                        </td>

                        <td>
                            <%#(Eval("M_content").ToString()).Trim().Length > 100 ? (Eval("M_content").ToString().Substring(0, 100) + "...") : (Eval("M_content").ToString()) %>
                        </td>
                        <td>
                            <%#((DateTime) Eval("M_Time")).ToString("yyyy-MM-dd HH:mm") %>
                        </td>

                        <td>
                            <%#Util.GetRealName(Eval("M_chief").ToString()) %>
                        </td>

                    </tr>
                </ItemTemplate>
            </asp:Repeater>
            </tbody>
        </table>
        <div class="pagin fr">
            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="10" FirstPageText="首页"
                                  LastPageText="尾页" NextPageText="后页" PrevPageText="前页" NumericButtonCount="9"
                                  ShowPageIndexBox="Never" AlwaysShow="True" OnPageChanging="AspNetPager1_PageChanging">
            </webdiyer:AspNetPager>
        </div>
    </div>
    <script type="text/javascript">
        function select() {
            $('#<%= btn_query.ClientID %>').click();
        };
    </script>
</form>
</body>
</html>